let token = localStorage.getItem("token")
localStorage.setItem("Refresh", 1)


//输入框获取光标
$(".change-nickname-box input").on("focus", function () {
    $(this).css("border-color", "#89B1FF")
    $("footer").css("display", "none")
}).on("blur", function () {
    $(this).css("border-color", "#d8d8d8")
    setTimeout(function () {
        $("footer").css("display", "flex")
    }, 300)
}).keydown(function (e) {
    if (e.keyCode == 13) {
        if ($(this).val()) {
            Sendajax("http://119.23.46.241:8080/login/personalpage/updatename", "post", {username: $(this).val()}, token)
        }
    }
})


$(".change-nickname-button").on("click", function (e) {
    if ($(".change-nickname-box input").val().trim().length > 0) {
        let updateNameNum = Sendajax("http://119.23.46.241:8080/login/personalpage/updatename", "post", {username: $(".change-nickname-box input").val()}, token)
        if (updateNameNum.code == 201) {
            $(".change-nickname-box input").val('')
            stop()
            layer.confirm('昵称修改成功', {
                btn: ['确定']
                , btn1: function (index, layero) {
                    window.history.back(-1)
                    move()
                }
            });
        }
    }
})